package com.example.demo;

import android.content.Context;
import android.content.SharedPreferences;
import android.content.res.Resources;

import com.alibaba.android.arouter.launcher.ARouter;

/**
 * 应用中要使用到的固定的常量值
 * Created by ouyang on 2019/10/30.
 */
public class AppConst {
    /**
     * 是否开启开发者模式
     */
    public static final boolean DevMode = true;

    /**
     * SharedPreferences 文件名
     */
    public static final String SharedPreferencesName = "ncp-sp";

    private static App sApplication;
    private static SharedPreferences sSharedPreferences;

    static void init(App app) {
        sApplication = app;
        sSharedPreferences = sApplication.getSharedPreferences(SharedPreferencesName, Context.MODE_PRIVATE);

        if (DevMode) {
            ARouter.openLog();
            ARouter.openDebug();
            ARouter.printStackTrace();
        }
        ARouter.init(sApplication);
    }

    public static App getApplication() {
        return sApplication;
    }

    public static Resources getResources() {
        return sApplication.getResources();
    }

    public static SharedPreferences getSharedPreferences() {
        return sSharedPreferences;
    }
}
